use thiserror::Error;

#[derive(Error, Debug, PartialEq, Eq)]
pub enum RespError {
    #[error("invalid frame:{0}")]
    InvalidateFrame(String),

    #[error("invalid frame type:{0}")]
    InvalidFrameType(String),

    #[error("invalid frame length:{0}")]
    InvalidFrameLength(isize),

    #[error("frame is not complete")]
    NotComplete,

    #[error("Parse error: {0}")]
    ParseIntError(#[from] std::num::ParseIntError),

    #[error("Utf8 error: {0}")]
    Utf8Error(#[from] std::string::FromUtf8Error),

    #[error("Parse float error: {0}")]
    ParseFloatError(#[from] std::num::ParseFloatError),
}
